﻿using System;

namespace Application
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            SolrNet.Startup.Init<SolrEntity>("http://localhost:8983/solr/collection1");
            //DatabaseManager db = new DatabaseManager();
            //db.GetAllDbs("c://TreeDb/");

            Console.WriteLine(string.Format("Hello {0} ... What do you do ? ", Environment.UserName));
            Console.WriteLine();
            Console.WriteLine();

            DatabaseManager manager = new DatabaseManager();
            string consoleCursor = "";
            string consoleCursorRec = "";
            string outEmpty = "";
            DataBaseBST.BST<string, object> tab = null;
            for (; ; )
            {

                if (consoleCursor == string.Empty)
                    Console.Write("write command >>> ");
                else
                    Console.Write(string.Format("{0} >>> ", consoleCursor));
                manager.setCommand(Console.ReadLine() , out consoleCursor, out tab);

                if (tab != null)
                {
                    consoleCursorRec += consoleCursor +  ".record";
                    for (; ; )
                    {
                        Console.Write(string.Format("{0} >>> ", consoleCursorRec));
                        var answer = Console.ReadLine();

                        if (answer == "goout")
                        {
                            tab = null;
                            Console.WriteLine("Ok ... Bye !");
                            break;
                        }
                        else
                        {
                            manager.setCommand(answer, out outEmpty, out tab);
                            
                        }
                    }
                }

            }


            Console.ReadKey();
        }




    }
}
